package top.pmwly.oauth2_jwt.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;

/**
 * @author Herther
 * @version 1.0.0
 * @ClassName ResourceServiceConfig.java
 * @Description 资源服务器配置类
 * @createTime 2021年08月23日 14:49:00
 */
@Configuration
@EnableResourceServer
public class ResourceServiceConfig extends ResourceServerConfigurerAdapter {

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                //授权只放行 user下的所有方法
                .antMatchers("/user/**")
                .permitAll()
                //
                .anyRequest()
                .authenticated();
    }
}
